<template>
	<view class="s-collapse">
		<slot />
	</view>
</template>

<script>
	import props from './props.js';

	export default {
		name: "s-collapse",
		mixins: [props],
		mounted() {
			
		},
		methods: {			
			onChange(target) {
				// 手风琴操作
				if(target?.expanded) {
					this.$children[0].$children.forEach(item=>{
						if(item!=target) {
							item.expanded = false
						}
					})
				}
				this.$emit(target.expanded ? 'open' : 'close', target.data, target)
			}
		}
	}
</script>

<style lang="scss" scoped>
	
</style>
